<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    if (path.endsWith("/"))
        path = path.substring(0, path.length() - 1);
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
    request.setAttribute("root", basePath);
%>
<!DOCTYPE HTML>
<html >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=0">
    <meta name="author" content="gkjk">

    <!-- Site CSS -->
    <link href='${pageContext.request.contextPath}/res/css/bootstrap.min.css' rel="stylesheet">
    <link href='${pageContext.request.contextPath}/res/css/web.min.css' rel="stylesheet">
    <style>
        
    </style>
    <title>微信安全支付</title>
</head>
<body>
    <div class="container mzcontainer">
        <div class="row mzrow mzrow-first">
            <div class="col-sm-12">
                <div class="mzcol mzcol-first">
                    <div class="order-info">${name}-订单编号${transactionid}</div>
                    <div class="order-info order-pay">总金额:${orderamount}元</div>
                </div>
            </div>
        </div>
        <div class="row mzrow">
            <div class="col-sm-12">
                <div class="mzcol">
                    <div class="order-info">您在"中国人寿保险公司"投保</div>
                    <div>"国受鸿康保险组合计划"保单号:23241232131</div>
                    <div class="mzhorizontal"></div>
                    <div class="order-payed">已为您理赔:0.00元</div>
                </div>
            </div>
        </div>
        <div class="row">
	        <div class="col-sm-12">
	        <div class="order-info">本次微信需支付:</div>
	        </div>
            <div class="col-sm-5 col-sm-offset-5">
                <div class="order-result">${orderamount}元</div>
            </div>
        </div>
        <div class="row mzrow-footer">
            <div class="col-sm-12">
                <div class="btn-group btn-group-justified">
                    <div class="btn-group">
                    	<!-- <form action="success.php" method="post" role="form">
                    		<input type="hidden" name="pay" value="100">
                    		<button type="submit" class="btn btn-default mzbtn">确认支付</button>
                    		<input id="payIt" type="button" value="确认支付" class="btn btn-default mzbtn"/>
                    	</form> -->
                        <input id="payIt" type="button" value="确认支付" class="btn btn-default mzbtn"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src='${pageContext.request.contextPath}/res/js/jquery.min.js'></script>
    <script src='${pageContext.request.contextPath}/res/js/bootstrap.min.js'></script>
    <script type="text/javascript">
      $(function(){
        $("#payIt").click(function(){
            if (typeof WeixinJSBridge == "undefined") {
                alert("请使用微信浏览器支付");
                return;
            }
           // $(this).disabled = true;
            $('#payIt').attr('disabled',true);
            WeixinJSBridge.invoke('getBrandWCPayRequest',{
                "appId": '${appId}',
                "timeStamp" : '${timeStamp}',
                "nonceStr" : '${nonceStr}',
                "package": '${package1}',
                "signType":'${signType}',
                "paySign" : '${paySign}'
            },function(res){
                //alert("支付结果："+res.err_msg);
                $('#payIt').attr('disabled',false);
                //alert("${pageContext.request.contextPath}/wx/toMer.action?sub_deal_ssn=${transactionid}");
               // alert(res.err_msg);
               //if(res.err_msg == "get_brand_wcpay_request:ok" ){
               //}else{
            	 //  alert("您已取消支付!");
               	 //  return;
               //}
               	 window.location.href='${pageContext.request.contextPath}/wx/toMer.action?sub_deal_ssn=${transactionid}';   
            });
        });
      });
  </script>
</body>
</html>